<?php
if($_SERVER['REQUEST_METHOD']=="POST") {
	$username = $_POST['username'];
	$password = $_POST['password'];
	try{
		$pdo = new PDO("mysql:host=127.0.0.1;port=3306;dbname=blog202","root","123456");
	} catch(PDOException $ex) {
		die("连接数据库失败:".$ex);
	}
	$sql = "select * from blog202 where username='".$username."' and password='".$password."'";
	$res = $pdo->query($sql, PDO::FETCH_ASSOC);
	$row = $res->fetch();
	if($row){
		die("登录成功，欢迎".$row['username']);
	} else {
		die("登录失败");
	}
	die("post类型的请求");
}
?>
<html lang="zh">
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=devic-width,initial-scale=1.0">
		<meta http-equiv="X-UA-Compatible" content="ie=edge">
		<title></title>
		<!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
		<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
		
		<!-- 可选的 Bootstrap 主题文件（一般不用引入） -->
		<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap-theme.min.css" integrity="sha384-6pzBo3FDv/PJ8r2KRkGHifhEocL+1X2rVCTTkUfGk7/0pbek5mMa1upzvWbrUbOZ" crossorigin="anonymous">
		
		<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
		<script src="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha384-aJ21OjlMXNL5UyIl/XNwTMqvzeRMZH2w8c5cRVpzpU8Y5bApTppSuUkhZXN0VxHd" crossorigin="anonymous"></script>
	<style>
		.login-box{
			margin-top: 200px;
			padding: 50px;
			border-radius: 20px;
			position: relative;
		}
		.login-box>div{
			margin-bottom: 20px;
		}
		body{
			background: url(img/3741eddce35b54e55a917a60d3230b4f144d6937.jpg) center no-repeat;
		background-size: cover;
		}
		html{
			height: 100%;
			overflow: hidden;
		}
		.login-box>.into{
			position: absolute;
			background-color: white;
			width: 100%;
			height: 100%;
			z-index: -1;
			top: -5px;
			left: -5px;
			opacity: 0.5;
			border-radius: 20px;
		}
		html{
			height: 100%;
			overflow: hidden;
		}
	</style>
	</head>
	<body>
		
		<div class="row">
			<form action="" method="post">
			<div class="col-md-4 col-md-offset-4 login-box">
		<div class="into"></div>
		<div class="input-group input-group-lg">
		  <span class="input-group-addon" id="sizing-addon1">账号</span>
		  <input type="text" name="username" class="form-control" placeholder="用户名" aria-describedby="sizing-addon1">
		</div>
		<div class="input-group input-group-lg">
		  <span class="input-group-addon" id="sizing-addon1">密码</span>
		  <input type="password" name="password" class="form-control" placeholder="密码" aria-describedby="sizing-addon1">
		</div>
		<div>
			<button type="submit" class="form-control btn btn-primary">登录</button>
		</div>
		</div>
		</form>
		</div>
		</body>
</html>